package org.jeecg.modules.staff.member.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.modules.constant.BikeConstant;
import org.jeecg.modules.param.staffUser.entity.LoginReq;
import org.jeecg.modules.staff.member.service.StaffService;
import org.jeecg.modules.user.member.dto.MemberPwdReq;
import org.jeecg.modules.utils.BikeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Api(tags="员工端")
@RestController
@RequestMapping("/staff/login")
@Slf4j
public class StaffController {

    @Autowired
    private StaffService staffService;

    @ApiOperation(value = "登录", notes = "登录")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public BikeResult addAdvise(@RequestBody LoginReq loginReq){
        return staffService.login(loginReq);
    }

    @ApiOperation(value = "员工端获取用户信息", notes = "员工端获取用户信息")
    @RequestMapping(value = "/getUserInfo", method = RequestMethod.POST)
    public BikeResult getUserInfo(HttpServletRequest request){
        return staffService.getUserInfo(request);
    }

    @ApiOperation(value = "修改密码", notes = "修改密码")
    @RequestMapping(value = "/updateStaffPassword", method = RequestMethod.POST)
    public BikeResult updateStaffPassword(@RequestBody MemberPwdReq memberPwdReq, HttpServletRequest request){
        return staffService.updateStaffPassword(memberPwdReq,request);
    }

    @ApiOperation(value = "协议获取", notes = "协议获取\"")
    @RequestMapping(value = "/getAgreement", method = RequestMethod.POST)
    public BikeResult getAgreement(){
        return staffService.getAgreement();
    }
}
